package com.trendwise.software;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

public class LogCoutsPerHour {

	
	public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException{
		
		String in=args[0],out=args[1];
		
		Configuration conf=new Configuration();
		
		Job job=Job.getInstance(conf);
		
		FileInputFormat.addInputPath(job, new Path(in));
		FileOutputFormat.setOutputPath(job, new Path(out));
		
		job.setMapperClass(WebMapper.class);
		job.setReducerClass(WebReducer.class);
		job.setCombinerClass(WebReducer.class);
		job.setMapOutputKeyClass(DateWritable.class);
		job.setMapOutputValueClass(IntWritable.class);
		job.setOutputKeyClass(DateWritable.class);
		job.setOutputValueClass(IntWritable.class);
		job.setJarByClass(LogCoutsPerHour.class);
		job.waitForCompletion(true);
	}
	
}
